# https://leetcode.cn/problems/two-sum/?envType=problem-list-v2&envId=array
from typing import List


class Solution:
    """
    >>> print(Solution().twoSum([2, 7, 11, 15]))

    """
    def twoSum(self, nums: List[int], target: int) -> List[int]:
        for i in range(len(nums)):
            res = target - nums[i]
            if res in nums[i + 1:]:
                return [i, nums[i + 1:].index(res) + i + 1]


if __name__ == '__main__':
    nums = [2, 7, 11, 15]
    target = 9
    s = Solution()
    print(s.twoSum(nums, target))
